Repository navigation
Conversation
362e7d4 to
cd87ccd
Compare
cd87ccd to
133ffeb
Compare
| }, | ||
| ); | ||
|
|
||
| for (const [apiURL, repository] of uniqueDownloadSources) { |
There was a problem hiding this comment.
This is just a URL, not an API URL, i.e. it doesn't start with api.
There was a problem hiding this comment.
The name was just copied from setup-codeql.ts, but I have renamed this to instanceURL to address the feedback. While doing that I also noticed that apiURL /instanceURL isn't actually used at all beyond the short-circuit check and in log messages. That seems like it may have been an oversight in your PR when you added this, because without this we just end up checking for the repos on whatever instance getApiClient decides to use instead of the intended apiURL /instanceURL?
There was a problem hiding this comment.
without this we just end up checking for the repos on whatever instance
getApiClientdecides to use instead of the intendedapiURL/instanceURL?
Sorry, could you explain what you mean by this? The intent is to check the called Action repo on the same GH instance, the canonical github/codeql-action on the same GH instance, followed by github/codeql-action on Dotcom.
| /** | ||
| * Asserts that `stub` must have been called once with at least the `expected` arguments. | ||
| */ | ||
| onceWith: <TArgs extends readonly any[]>( |
There was a problem hiding this comment.
Beyond your later fix in f9a9962, I think this should just be calledWith, since unlike calledOnce / calledOnceWithExactly / calledOnceWithMatch we don't validate that the stub was only called once.
There was a problem hiding this comment.
I am unsure if your comment here is a request to change anything, since f9a9962 has addressed this in the way I had intended.
There was a problem hiding this comment.
The matchers calledOnce, calledOnceWithExactly, and calledOnceWithMatch in sinon each require exactly one call in total, irrespective of the match, whereas this matcher permits the function to be called multiple times. So for consistency I think we should drop the once from the name of this matcher in favour of something like calledWith or calledAtLeastOnceWith.
henrymercer
left a comment
There was a problem hiding this comment.
Couple of additional comments
| /** Types that all of our logging functions accept. */ | ||
| export type Loggable = string | string[]; |
There was a problem hiding this comment.
Looking back at this after a commit-by-commit review, does anything use this? If not, let's remove it.
There was a problem hiding this comment.
It's used by other definitions in logging.ts below (same commit that introduced the definition).
There was a problem hiding this comment.
Ah, I mean to say that none of our source code passes an array to a logger. We can keep it if you feel strongly about it though.
There was a problem hiding this comment.
I mean to say that none of our source code passes an array to a logger
Ah. I did have at least one place that used this when I added it but maybe that went away while I was working on this PR. In any case, I have come across the same need in some of my other work, so I do think this is a useful addition whether this PR makes use of it or not.
The
start-proxyAction currently uses its owngetReleaseByVersionfunction to get hold of the release that we expect to find the proxy assets at. That function has hard-codedownerandrepovalues for the defaultgithub/codeql-actionrepository. This repository may not be available in all environments. In such environments,getReleaseByVersionfails and we fall-back to the hard-coded release obtained fromgetFallbackUrlinstead.Broadly, this PR does the following:
getCodeQLActionRepositoryandgetCodeQLBundleDownloadURLare refactored out ofsetup-codeqlinto a newsetup/repositorymodule.getCodeQLAssetDownloadURL(renamed fromgetCodeQLBundleDownloadURL) in thestart-proxyaction to apply the same logic for finding a suitable release as used bysetup-codeql.getCodeQLBundleDownloadURLis essentially equivalent, except that it uses the linked version rather than a hard-coded one. We have been shipping proxy artifacts successfully with releases for a good while now, so the fallback shouldn't be needed anymore.There are some drive-by improvements to logging and assertions for sinon stubs.
Risk assessment
For internal use only. Please select the risk level of this change:
Which use cases does this change impact?
Workflow types:
dynamicworkflows (Default Setup, Code Quality, ...).Products:
analysis-kinds: code-scanning.analysis-kinds: code-quality.Environments:
github.comand/or GitHub Enterprise Cloud with Data Residency.How did/will you validate this change?
.test.tsfiles).pr-checks).If something goes wrong after this change is released, what are the mitigation and rollback strategies?
How will you know if something goes wrong after this change is released?
Are there any special considerations for merging or releasing this change?
Merge / deployment checklist